package com.tanhua.dubbo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tanhua.domain.db.UserInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 数据访问层
 */
public interface UserInfoMapper extends BaseMapper<UserInfo> {


    /**
     * 分页查询黑名单用户列表
     * @param page
     * @param userId
     * @return
     */
    @Select("SELECT info.* from tb_black_list b, tb_user_info info where" +
            " b.black_user_id = info.id and b.user_id = #{userId}")
    IPage<UserInfo> findBlackList(IPage<UserInfo> page, @Param("userId") Long userId);

    @Select("select count(*) from tb_user_info")
    Integer allUserNum();
}